description "Datadog statsd server"

start on started networking or started network
stop on runlevel [!2345]

respawn
respawn limit 4 25
normal exit 0

# console log is not available before upstart 1.4. CentOS/RHEL6 use an earlier version of upstart.
console output
env DD_LOG_TO_CONSOLE=false

script
  # setuid is not available in versions of upstart before 1.4. CentOS/RHEL6 use an earlier version of upstart.
  # This is the best way to set the user in the absence of setuid.
  exec su -s /bin/sh -c 'exec "$0" "$@"' dd-agent -- <%= install_dir %>/bin/dogstatsd start -c /etc/datadog-dogstatsd
end script
